package com.uchengwang.ui.cm_ui.ucity.ui;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.TextView;

import com.uchengwang.R;
import com.uchengwang.ui.cm_ui.ucity.adapter.SearchAdapter;
import com.zhy.autolayout.AutoLayoutActivity;

import java.util.Arrays;
import java.util.List;

/**
 * Created by U城网 on 2017/6/3.
 */

public class SearchActivity extends AutoLayoutActivity{
    private EditText search_edit;
    private TextView search_search;
    private GridView search_gv;
    private SearchAdapter adapter;
    private List<String> strings;



    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_search);
        initView();
    }

    private void initView (){
        search_edit = (EditText) findViewById(R.id.search_gv);
        search_search = (TextView) findViewById(R.id.search_search);
        search_gv = (GridView) findViewById(R.id.search_gv);

        initData();
    }

    private void initData (){
        strings = Arrays.asList(getResources().getStringArray(R.array.search));
        adapter = new SearchAdapter(this, strings);
        search_gv.setAdapter(adapter);

        search_gv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {


            }
        });


    }
}
